|
|
|
| Table 3.3. The controls for the Database.vbp project. | | Control | Property | Setting | | Form | Caption | Database Objects Demo | | WindowState | Maximize | | DataControl | Alignment | Align Bottom | | DatabaseName | "BOOKS5.MDB" | | RecordSource | Authors |
|
|
|
|
|
|
Be sure to place the data control at the very bottom of the form. It is only there to give you access to the various database properties that you print on the form itself. Enter the program code in Listing 3.15 in the Form_Activate event. |
|
|
|
|
|
|
|
|
Listing 3.15. Listing Database objects. |
|
|
|
|
|
|
|
|
Private Sub Form_Activate()
'
' show high-level database objects
'
Dim tb As TableDef
Dim fl As Field
Dim ix As Index
Data1.DatabaseName = App.Path & "\..\..\data\books5.mdb"
Data1.Refresh
'
For Each tb In Data1.Database.TableDefs
Me.Print "Table Info:"
Print " "; tb.Name
For Each fl In tb.Fields
Print " -"; fl.Name
Next
MsgBox "Press OK to continue"
Me.Cls
Next
'
On Error Resume Next ' in case there's no index
'
For Each tb In Data1.Database.TableDefs
Me.Print "Index Info:"
Print " "; tb.Name
For Each ix In tb.Indexes
Print " -"; ix.Name;
Print "[";
Print ix.Fields;
Print "]" |
|
|
|
|
|